package com.dkm.ec.so.repository.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.dkm.base.api.model.Page;
import com.dkm.base.core.helper.SpringHelper;
import com.dkm.base.db.persistence.dao.IQueryDao;
import com.dkm.biz.repository.AbstractRepository;
import com.dkm.ec.so.domain.SoEntity;
import com.dkm.ec.so.repository.SoEntityRepository;
import com.dkm.ec.so.persistence.dao.SoEntityQueryDao;
import com.dkm.ec.so.persistence.entity.SoEntityPo;

/**
 * 对象功能:销售订单。 Repository接口的实现类
 * 开发公司:dkm.com
 * 开发人员:ZHH
 * 创建时间:2017-05-19 15:50:21
 */
@Repository
public class SoEntityRepositoryImpl extends AbstractRepository<String, SoEntityPo,SoEntity> implements SoEntityRepository{
	  
	@Resource
	private  SoEntityQueryDao soEntityQueryDao;

	public SoEntity newInstance() {
		SoEntityPo po = new SoEntityPo();
		SoEntity soEntity = SpringHelper.getBean(SoEntity.class);
		soEntity.setData(po);
		return soEntity;
	}

	public SoEntity newInstance(SoEntityPo po) {
		SoEntity soEntity = SpringHelper.getBean(SoEntity.class);
		soEntity.setData(po);
		return soEntity;
	} 
	
	@Override
	protected IQueryDao<String, SoEntityPo> getQueryDao() {
		return soEntityQueryDao;
	}

	@Override
	public List<SoEntityPo> findByListByPartyId(String id, String soStatus,Page page) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("soStatus", soStatus);
		params.put("partyId", id);
		return soEntityQueryDao.findByKey("findByListByPartyId", params,page);
	}
	
}
